package spring.in.action.chapter_02;

import java.util.List;

import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Component;

//@Component
@Component("fantasy+")
public class FantasyPlus implements ICD
{
    private String title = "Fantasy Plus";

    private String artist = "Jay,Chou";

    private List<String> tracks;

    public FantasyPlus()
    {
    }

    public FantasyPlus(String pTitle, String pArtist)
    {
        this.title = pTitle;
        this.artist = pArtist;
    }

    public FantasyPlus(String pTitle, String pArtist, List<String> pTracks)
    {
        this.title = pTitle;
        this.artist = pArtist;
        this.tracks = pTracks;
    }

    @Override
    public void play()
    {
        System.out.println("播放 " + artist + "的 " + title);
        if (CollectionUtils.isNotEmpty(tracks))
        {
            tracks.forEach(System.out::println);
        }
    }

    public void setTitle(String pTitle)
    {
        this.title = pTitle;
    }

    public void setArtist(String pArtist)
    {
        this.artist = pArtist;
    }

    public void setTracks(List<String> pTracks)
    {
        this.tracks = pTracks;
    }

}
